{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "initial_id",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-07-16T13:51:51.574058Z",
     "start_time": "2024-07-16T13:51:51.567750Z"
    },
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "John\n",
      "Mary\n",
      "Tom\n"
     ]
    }
   ],
   "source": [
    "class Company:\n",
    "    def __init__(self, employees):\n",
    "        self.employees = employees\n",
    "    def __getitem__(self, index):\n",
    "        # print(index)\n",
    "        return self.employees[index]\n",
    "company = Company([\"John\", \"Mary\", \"Tom\"])\n",
    "for i in company:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "7f615f1257a01645",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-07-16T13:50:52.763645Z",
     "start_time": "2024-07-16T13:50:52.742950Z"
    },
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['John', 'Mary']"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "company[:2]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
